<?php
class BaseVO {

     public function createFromObject($obj) {                 
          $clazzName = get_class($this);
          $clazz = new $clazzName();
          $class_vars = get_class_vars($clazzName);          
          
          foreach ($class_vars as $varName => $value) {
             $clazz->$varName = $obj->$varName;
          }       
          return $clazz;     
     }
     
     public function createFromArray($arr) {                 
          $clazzName = get_class($this);
          $clazz = new $clazzName();
          $class_vars = get_class_vars($clazzName);          
          
          foreach ($class_vars as $varName => $value) {
             $clazz->$varName = $arr[$varName];
          }       
          return $clazz;     
     }     
     
     public function updateFromObject($obj) {                 
          $clazzName = get_class($this);
          $class_vars = get_class_vars($clazzName);          
          
          foreach ($class_vars as $varName => $value) {
             $this->$varName = $obj->$varName;
          }            
     }    
     
     public function updateFromArray($arr) {                 
          $clazzName = get_class($this);
          $class_vars = get_class_vars($clazzName);          
          
          foreach ($class_vars as $varName => $value) {
             $this->$varName = $arr[$varName];
          }       
     }     
           
     
}

?>